Collaborators: Shane Blowes, Jon Chase, Helmut Hillebrand, Michael Burrows, Amanda Bates, Uli Brose, Benoit Gauzens, Laura Antao Assistance: Katherine Lew, Josef Hauser
library(data.table) # for handling large datasets
library(ggplot2) # for some plotting
#library(lme4)
library(nlme) # for ME models
library(beanplot) # for beanplots
library(maps) # for map
library(ggeffects) # marginal effect plots
library(gridExtra) # to combine ggplots together
library(grid) # to combine ggplots together
library(gridExtra)
options(width=500) # turn off most text wrapping
# tell RStudio to use project root directory as the root for this notebook. Needed since we are storing code in a separate directory.
knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file())
# Turnover and covariates assembled by turnover_vs_temperature_prep.Rmd
trends <- fread('output/turnover_w_covariates.csv.gz')
# set realm order
trends[, REALM := factor(REALM, levels = c('Freshwater', 'Marine', 'Terrestrial'), ordered = FALSE)]
# group Marine invertebrates/plants in with All
trends[, taxa_mod2 := taxa_mod]
trends[taxa_mod == 'Marine invertebrates/plants', taxa_mod2 := 'All']
Log-transform some variables, then center and scale.
trends[, tempave.sc := scale(tempave)]
trends[, tempave_metab.sc := scale(tempave_metab)]
trends[, seas.sc := scale(seas)]
trends[, microclim.sc := scale(log(microclim))]
trends[, temptrend.sc := scale(temptrend)]
trends[, temptrend_abs.sc := scale(log(abs(temptrend)))]
trends[, npp.sc := scale(log(npp))]
trends[, mass.sc := scale(log(mass_mean_weight))]
trends[, speed.sc := scale(log(speed_mean_weight+1))]
trends[, lifespan.sc := scale(log(lifespan_mean_weight))]
trends[, thermal_bias.sc := scale(thermal_bias)]
trends[, consumerfrac.sc := scale(consfrac)]
trends[, endothermfrac.sc := scale(endofrac)]
trends[, nspp.sc := scale(log(Nspp))]
trends[, human.sc := scale(human)]
# histograms to examine
cexmain = 0.6
par(mfrow = c(3,5))
invisible(trends[, hist(tempave.sc, main = 'Environmental temperature (°C)', cex.main = cexmain)])
invisible(trends[, hist(tempave_metab.sc, main = 'Metabolic temperature (°C)', cex.main = cexmain)])
invisible(trends[, hist(seas.sc, main = 'Seasonality (°C)', cex.main = cexmain)])
invisible(trends[, hist(microclim.sc, main = 'log Microclimates (°C)', cex.main = cexmain)])
invisible(trends[, hist(temptrend.sc, main = 'Temperature trend (°C/yr)', cex.main = cexmain)])
invisible(trends[, hist(temptrend_abs.sc, main = 'log abs(Temperature trend) (°C/yr)', cex.main = cexmain)])
invisible(trends[, hist(mass.sc, main = 'log Mass (g)', cex.main = cexmain)])
invisible(trends[, hist(speed.sc, main = 'log Speed (km/hr)', cex.main = cexmain)])
invisible(trends[, hist(lifespan.sc, main = 'log Lifespan (yr)', cex.main = cexmain)])
invisible(trends[, hist(consumerfrac.sc, main = 'Consumers (fraction)', cex.main = cexmain)])
invisible(trends[, hist(endothermfrac.sc, main = 'Endotherms (fraction)', cex.main = cexmain)])
invisible(trends[, hist(nspp.sc, main = 'log Species richness', cex.main = cexmain)])
invisible(trends[, hist(thermal_bias.sc, main = 'Thermal bias (°C)', cex.main = cexmain)])
invisible(trends[, hist(npp.sc, main = 'log Net primary productivity', cex.main = cexmain)])
invisible(trends[, hist(human.sc, main = 'Human impact score', cex.main = cexmain)])
panel.cor <- function(x, y, digits = 2, prefix = "", cex.cor, ...)
{
usr <- par("usr"); on.exit(par(usr))
par(usr = c(0, 1, 0, 1))
r <- cor(x, y, use = 'pairwise.complete.obs')
txt <- format(c(r, 0.123456789), digits = digits)[1]
txt <- paste0(prefix, txt)
if(missing(cex.cor)) cex.cor <- 0.8/strwidth(txt)
text(0.5, 0.5, txt) #, cex = cex.cor * r)
}
pairs(formula = ~ REALM + tempave.sc + tempave_metab.sc + seas.sc + microclim.sc + temptrend.sc + temptrend_abs.sc + mass.sc + speed.sc + lifespan.sc + consumerfrac.sc + endothermfrac.sc + nspp.sc + thermal_bias.sc + npp.sc + human.sc, data = trends, gap = 1/10, cex = 0.2, col = '#00000022', lower.panel = panel.cor)
Mass and lifespan look tightly correlated, but r only 0.56…? Tempave_metab and lifespan don’t look tightly correlated, but r= -0.81 Tempave_metab and speed don’t look tightly correlated, but r= -0.83 Lifespan and speed don’t look tightly correlated, but r = 0.73
Just turnover
cat('Overall # time-series: ', nrow(trends), '\n')
Overall # time-series: 53013
cat('# studies: ', trends[, length(unique(STUDY_ID))], '\n')
# studies: 332
cat('Data points: ', trends[, sum(nyrBT)], '\n')
Data points: 293973
trends[, table(REALM)]
REALM
Freshwater Marine Terrestrial
1025 48647 3341
trends[, table(taxa_mod)]
taxa_mod
All Amphibians Benthos Birds
1705 379 4679 13741
Fish Invertebrates Mammals Marine invertebrates/plants
28473 2996 525 206
Plant Reptiles
305 4
trends[, table(taxa_mod, REALM)]
REALM
taxa_mod Freshwater Marine Terrestrial
All 0 1702 3
Amphibians 2 0 377
Benthos 0 4679 0
Birds 0 11099 2642
Fish 1006 27467 0
Invertebrates 15 2901 80
Mammals 0 478 47
Marine invertebrates/plants 0 206 0
Plant 1 115 189
Reptiles 1 0 3
With all covariates
# the cases we can compare
apply(trends[, .(Jtutrend, REALM, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc, temptrend.sc, mass.sc, speed.sc, lifespan.sc, consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc, human.sc)], MARGIN = 2, FUN = function(x) sum(!is.na(x)))
Jtutrend REALM tempave.sc tempave_metab.sc seas.sc microclim.sc
53013 53013 49916 49916 49916 51834
temptrend.sc mass.sc speed.sc lifespan.sc consumerfrac.sc endothermfrac.sc
49916 52820 52689 51540 47534 53013
nspp.sc thermal_bias.sc npp.sc human.sc
53013 49371 52863 53013
i <- trends[, complete.cases(Jtutrend, temptrend.sc, tempave_metab.sc, REALM, seas.sc, microclim.sc, npp.sc, mass.sc, speed.sc, lifespan.sc, consumerfrac.sc, thermal_bias.sc)]
cat('Overall # time-series: ', sum(i), '\n')
Overall # time-series: 43585
cat('# studies: ', trends[i, length(unique(STUDY_ID))], '\n')
# studies: 250
cat('Data points: ', trends[i, sum(nyrBT)], '\n')
Data points: 222824
trends[i, table(REALM)]
REALM
Freshwater Marine Terrestrial
1008 39735 2842
trends[i, table(taxa_mod)]
taxa_mod
All Amphibians Benthos Birds Fish Invertebrates Mammals Plant
521 12 590 11803 27372 2567 518 200
Reptiles
2
trends[i, table(taxa_mod, REALM)]
REALM
taxa_mod Freshwater Marine Terrestrial
All 0 520 1
Amphibians 2 0 10
Benthos 0 590 0
Birds 0 9221 2582
Fish 993 26379 0
Invertebrates 12 2484 71
Mammals 0 477 41
Plant 1 64 135
Reptiles 0 0 2
Try combinations of
And choose the one with lowest AIC (not run: takes a long time)
# fit models for variance structure
fixed <- formula(Jtutrend ~ REALM + tempave_metab.sc + seas.sc + microclim.sc + npp.sc + temptrend_abs.sc +
mass.sc + speed.sc + lifespan.sc + consumerfrac.sc + thermal_bias.sc)
i <- trends[, complete.cases(Jtutrend, REALM, tempave_metab.sc, seas.sc, microclim.sc, npp.sc, temptrend_abs.sc,
mass.sc, speed.sc, lifespan.sc, consumerfrac.sc, thermal_bias.sc)]
mods <- vector('list', 0)
mods[[1]] <- gls(fixed, data = trends[i,])
mods[[2]] <- gls(fixed, data = trends[i,], weights = varPower(-0.5, ~nyrBT))
mods[[3]] <- gls(fixed, data = trends[i,], weights = varPower(0.5, ~ abs(temptrend)))
mods[[4]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2, control = lmeControl(opt = "optim"))
mods[[5]] <- lme(fixed, data = trends[i,], random = ~1|STUDY_ID, control = lmeControl(opt = "optim"))
mods[[6]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2/STUDY_ID, control = lmeControl(opt = "optim"))
mods[[7]] <- lme(fixed, data = trends[i,], random = ~1|STUDY_ID/rarefyID, control = lmeControl(opt = "optim"))
mods[[8]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2/STUDY_ID/rarefyID, control = lmeControl(opt = "optim"))
mods[[9]] <- lme(fixed, data = trends[i,], random = ~temptrend_abs.sc | taxa_mod)
mods[[10]] <- lme(fixed, data = trends[i,], random = ~temptrend_abs.sc | STUDY_ID)
mods[[11]] <- lme(fixed, data = trends[i,], random = ~temptrend_abs.sc | taxa_mod2/STUDY_ID, control = lmeControl(opt = "optim"))
mods[[12]] <- lme(fixed, data = trends[i,], random = list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1)) # includes overdispersion. new formula so that random slope is only for study level (not enough data to extend to rarefyID).
mods[[13]] <- lme(fixed, data = trends[i,], random = list(taxa_mod2 = ~ temptrend_abs.sc, STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1)) # 30+ min to fit
mods[[14]] <- lme(fixed, data = trends[i,], random = ~1|STUDY_ID, weights = varPower(-0.5, ~nyrBT))
mods[[15]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2, weights = varPower(-0.5, ~nyrBT))
mods[[16]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2/STUDY_ID, weights = varPower(-0.5, ~nyrBT))
mods[[17]] <- lme(fixed, data = trends[i,], random = ~1|STUDY_ID/rarefyID, weights = varPower(-0.5, ~nyrBT))
mods[[18]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2/STUDY_ID/rarefyID, weights = varPower(-0.5, ~nyrBT))
mods[[19]] <- lme(fixed, data = trends[i,], random = ~temptrend_abs.sc|STUDY_ID, weights = varPower(-0.5, ~nyrBT))
mods[[20]] <- lme(fixed, data = trends[i,], random = list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1), weights = varPower(-0.5, ~nyrBT))
mods[[21]] <- lme(fixed, data = trends[i,], random = list(taxa_mod2 = ~ temptrend_abs.sc, STUDY_ID = ~ 1), weights = varPower(-0.5, ~nyrBT))
mods[[22]] <- lme(fixed, data = trends[i,], random = list(taxa_mod2 = ~ temptrend_abs.sc, STUDY_ID = ~ 1, rarefyID = ~1), weights = varPower(-0.5, ~nyrBT))
mods[[23]] <- lme(fixed, data = trends[i,], random = list(taxa_mod2 = ~ temptrend_abs.sc, STUDY_ID = ~ temptrend_abs.sc), weights = varPower(-0.5, ~nyrBT)) # singular precision warning with lmeControl(opt = 'optim') and convergence error without
mods[[24]] <- lme(fixed, data = trends[i,], random = list(taxa_mod2 = ~ temptrend_abs.sc, STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1), weights = varPower(-0.5, ~nyrBT)) # singular precision warning with lmeControl(opt = 'optim') and convergence error without
mods[[25]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2, weights = varPower(-0.5, ~abs(temptrend)))
mods[[26]] <- lme(fixed, data = trends[i,], random = ~1|STUDY_ID, weights = varPower(-0.5, ~abs(temptrend)))
mods[[27]] <- lme(fixed, data = trends[i,], random = ~1|STUDY_ID/rarefyID, weights = varPower(-0.5, ~abs(temptrend)))
mods[[28]] <- lme(fixed, data = trends[i,], random = ~1|taxa_mod2/STUDY_ID/rarefyID, weights = varPower(-0.5, ~abs(temptrend)))
mods[[29]] <- lme(fixed, data = trends[i,], random = ~temptrend_abs.sc|STUDY_ID, weights = varPower(-0.5, ~abs(temptrend)))
mods[[30]] <- lme(fixed, data = trends[i,], random = ~temptrend_abs.sc|taxa_mod2/STUDY_ID, weights = varPower(-0.5, ~abs(temptrend)), control = lmeControl(opt = "optim"))
mods[[31]] <- lme(fixed, data = trends[i,], random = list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1), weights = varPower(-0.5, ~abs(temptrend)))
mods[[32]] <- lme(fixed, data = trends[i,], random = list(taxa_mod2 = ~ temptrend_abs.sc, STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1), weights = varPower(-0.5, ~abs(temptrend)), control = lmeControl(opt = "optim")) # singular precision warning
aics <- sapply(mods, AIC)
minaics <- aics - min(aics)
minaics
which.min(aics)
Chooses the random slopes (temptrend_abs) & intercepts for STUDY_ID, overdispersion, and variance scaled to number of years. We haven’t dealt with potential testing on the boundary issues here yet.
world <- map_data('world')
ggplot(world, aes(x = long, y = lat, group = group)) +
geom_polygon(fill = 'lightgray', color = 'white') +
geom_point(data = trends, aes(rarefyID_x, rarefyID_y, group = REALM, color = REALM), size = 0.5, alpha = 0.4) +
scale_color_brewer(palette="Set1", name = 'Realm') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.key=element_blank(),
axis.text=element_text(size=16),
axis.title=element_text(size=20)) +
labs(x = 'Longitude (°)', y = 'Latitude (°)')
Mostly northern hemisphere, but spread all over. No so much in Africa or much of Asia.
Lines are ggplot smoother fits by realm.
Strong trends with temperature change, but trends are pretty symmetric around no trend in temperature, which implies warming or cooling drives similar degree of community turnover. Some indication of less turnover for larger organisms (mass) Higher turnover on land with higher seasonality? More turnover for shorter-lived organisms? No really clear differences among realms.
Average rates of turnover
trends[abs(temptrend) >= 0.5, .(mean(Jtutrend), sd(Jtutrend)/sqrt(.N))] # turnover per year for locations changing temperature
trends[abs(temptrend) < 0.1, .(mean(Jtutrend), sd(Jtutrend)/sqrt(.N))] # not changing temperature
trends[temptrend >= 0.5, .(mean(Jtutrend), sd(Jtutrend)/sqrt(.N))] # warming
trends[temptrend <= -0.5, .(mean(Jtutrend), sd(Jtutrend)/sqrt(.N))] # cooling
trends[abs(temptrend) >= 0.5 & abs(rarefyID_y) < 35, .(mean(Jtutrend), sd(Jtutrend)/sqrt(.N))] # tropics and sub-tropics
trends[abs(temptrend) >= 0.5 & abs(rarefyID_y) >= 35 & abs(rarefyID_y) < 66.56339, .(mean(Jtutrend), sd(Jtutrend)/sqrt(.N))] # temperate
trends[abs(temptrend) >= 0.5 & abs(rarefyID_y) >= 66.56339, .(mean(Jtutrend), sd(Jtutrend)/sqrt(.N))] # arctic
Hexagonal bins
require(ggplot2)
ggplot(trends[REALM == 'Terrestrial',], aes(temptrend, Jtutrend)) +
geom_hex() +
scale_fill_gradient(trans = "log")
ggplot(trends[REALM == 'Marine',], aes(temptrend, Jtutrend)) +
geom_hex() +
scale_fill_gradient(trans = "log")
ggplot(trends[REALM == 'Freshwater',], aes(temptrend, Jtutrend)) +
geom_hex() +
scale_fill_gradient(trans = "log")
i <- trends[, !duplicated(rarefyID)]; sum(i)
par(mfrow=c(5,3))
beanplot(rarefyID_y ~ REALM, data = trends[i,], what = c(1,1,1,1), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", ylab = 'Latitude (degN)', ll = 0.05)
beanplot(tempave ~ REALM, data = trends[i,], what = c(1,1,1,1), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", ylab = 'Temperature (degC)', ll = 0.05)
beanplot(tempave_metab ~ REALM, data = trends[i,], what = c(1,1,1,1), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", ylab = 'Metabolic Temperature (degC)', ll = 0.05, bw = 'nrd0') # nrd0 bandwidth to calculation gap
beanplot(seas ~ REALM, data = trends[i,], what = c(1,1,1,1), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", ylab = 'Seasonality (degC)', ll = 0.05)
beanplot(microclim ~ REALM, data = trends[i,], what = c(1,1,1,1), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", ylab = 'Microclimates (degC)', ll = 0.05)
beanplot(temptrend ~ REALM, data = trends[i,], what = c(1,1,1,1), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", ylab = 'Temperature trend (degC/yr)', ll = 0.05)
beanplot(mass_mean_weight ~ REALM, data = trends[i,], what = c(1,1,1,1), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", ylab = 'Mass (g)', ll = 0.05, log = 'y')
beanplot(speed_mean_weight +1 ~ REALM, data = trends[i,], what = c(1,1,1,1), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", ylab = 'Speed (km/hr)', ll = 0.05, log = 'y')
beanplot(lifespan_mean_weight ~ REALM, data = trends[i,], what = c(1,1,1,1), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", ylab = 'Lifespan (yr)', ll = 0.05, log = 'y')
#beanplot(consfrac ~ REALM, data = trends[i,], what = c(1,1,1,1), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", ylab = 'Consumers (fraction)', ll = 0.05, log = '') # too sparse
#beanplot(endofrac ~ REALM, data = trends[i,], what = c(1,1,1,1), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", ylab = 'Endotherms (fraction)', ll = 0.05, log = '') # too sparse
beanplot(Nspp ~ REALM, data = trends[i,], what = c(1,1,1,1), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", ylab = 'Number of species', ll = 0.05, log = 'y')
beanplot(thermal_bias ~ REALM, data = trends[i & !is.na(thermal_bias),], what = c(1,1,1,1), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", ylab = 'Thermal bias (degC)', ll = 0.05)
beanplot(npp ~ REALM, data = trends[i,], what = c(1,1,1,1), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", ylab = 'NPP', ll = 0.05)
beanplot(human ~ REALM, data = trends[i,], what = c(1,1,1,1), col = c("#CAB2D6", "#33A02C", "#B2DF8A"), border = "#CAB2D6", ylab = 'Human impact score', ll = 0.05)
Marine are in generally warmer locations (seawater doesn’t freeze) Marine have much lower seasonality. Marine and freshwater have some very small masses (plankton), but much of dataset is similar to terrestrial. Marine has a lot of slow, crawling organisms, but land has plants. Land also has birds (fast).
summary(modonlyTtrend)
Linear mixed-effects model fit by REML
Data: trends[i, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.04460504 (Intr)
temptrend_abs.sc 0.01904043 0.156
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.001713667 0.2946268
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.23577
Fixed effects: Jtutrend ~ abs(temptrend) * REALM
Correlation:
(Intr) abs(t) REALMM REALMT a():REALMM
abs(temptrend) -0.175
REALMMarine -0.928 0.162
REALMTerrestrial -0.928 0.162 0.861
abs(temptrend):REALMMarine 0.173 -0.990 -0.164 -0.161
abs(temptrend):REALMTerrestrial 0.172 -0.984 -0.160 -0.166 0.974
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-8.46254351 -0.30730773 0.08443652 0.54660915 6.61661896
Number of Observations: 49916
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
317 49916
summary(modonlyTtrendJbeta)
Linear mixed-effects model fit by REML
Data: trends[i2, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.05659393 (Intr)
temptrend_abs.sc 0.02520050 0.021
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 1.693577e-06 0.3590015
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.413558
Fixed effects: Jbetatrend ~ abs(temptrend) * REALM
Correlation:
(Intr) abs(t) REALMM REALMT a():REALMM
abs(temptrend) -0.160
REALMMarine -0.928 0.148
REALMTerrestrial -0.931 0.149 0.864
abs(temptrend):REALMMarine 0.158 -0.991 -0.150 -0.147
abs(temptrend):REALMTerrestrial 0.157 -0.986 -0.146 -0.151 0.976
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-7.8997139 -0.1696297 0.2037637 0.6704994 6.6449583
Number of Observations: 49916
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
317 49916
summary(modonlyTtrendHorn)
Linear mixed-effects model fit by REML
Data: trends[i3, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.05792109 (Intr)
temptrend_abs.sc 0.02134495 0.134
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.007146559 0.306766
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.217277
Fixed effects: Horntrend ~ abs(temptrend) * REALM
Correlation:
(Intr) abs(t) REALMM REALMT a():REALMM
abs(temptrend) -0.154
REALMMarine -0.914 0.141
REALMTerrestrial -0.925 0.143 0.845
abs(temptrend):REALMMarine 0.153 -0.989 -0.142 -0.141
abs(temptrend):REALMTerrestrial 0.152 -0.984 -0.139 -0.146 0.973
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-6.16836348 -0.32501087 0.06399723 0.53830958 5.96234033
Number of Observations: 48800
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
276 48800
if(file.exists('temp/modonlyTtrendsimpreml.rds')){
modonlyTtrendsimpreml <- readRDS('temp/modonlyTtrendsimpreml.rds')
} else {
require(MASS) # for stepAIC
modonlyTtrendml <- update(modonlyTtrend, method = 'ML')
modonlyTtrendsimp <- stepAIC(modonlyTtrendml, direction = 'backward')
modonlyTtrendsimpreml <- update(modonlyTtrendsimp, method = 'REML')
saveRDS(modonlyTtrendsimpreml, file = 'temp/modonlyTtrendsimpreml.rds')
}
if(file.exists('temp/modonlyTtrendJbetasimpreml.rds')){
modonlyTtrendJbetasimpreml <- readRDS('temp/modonlyTtrendJbetasimpreml.rds')
} else {
require(MASS) # for stepAIC
modonlyTtrendJbetaml <- update(modonlyTtrendJbeta, method = 'ML')
modonlyTtrendJbetasimp <- stepAIC(modonlyTtrendJbetaml, direction = 'backward')
modonlyTtrendJbetasimpreml <- update(modonlyTtrendJbetasimp, method = 'REML')
saveRDS(modonlyTtrendJbetasimpreml, file = 'temp/modonlyTtrendJbetasimpreml.rds')
}
Start: AIC=-165090
Jbetatrend ~ abs(temptrend) * REALM
Df AIC
<none> -165090
- abs(temptrend):REALM 2 -164091
if(file.exists('temp/modonlyTtrendHornsimpreml.rds')){
modonlyTtrendHornsimpreml <- readRDS('temp/modonlyTtrendHornsimpreml.rds')
} else {
require(MASS) # for stepAIC
modonlyTtrendHornml <- update(modonlyTtrendHorn, method = 'ML')
modonlyTtrendHornsimp <- stepAIC(modonlyTtrendHornml, direction = 'backward')
modonlyTtrendHornsimpreml <- update(modonlyTtrendHornsimp, method = 'REML')
saveRDS(modonlyTtrendHornsimpreml, file = 'temp/modonlyTtrendHornsimpreml.rds')
}
Start: AIC=-146055.2
Horntrend ~ abs(temptrend) * REALM
Df AIC
<none> -146055
- abs(temptrend):REALM 2 -145334
summary(modonlyTtrendsimpreml)
Linear mixed-effects model fit by REML
Data: trends[i, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.04460504 (Intr)
temptrend_abs.sc 0.01904043 0.156
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.001713667 0.2946268
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.23577
Fixed effects: Jtutrend ~ abs(temptrend) * REALM
Correlation:
(Intr) abs(t) REALMM REALMT a():REALMM
abs(temptrend) -0.175
REALMMarine -0.928 0.162
REALMTerrestrial -0.928 0.162 0.861
abs(temptrend):REALMMarine 0.173 -0.990 -0.164 -0.161
abs(temptrend):REALMTerrestrial 0.172 -0.984 -0.160 -0.166 0.974
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-8.46254351 -0.30730773 0.08443652 0.54660915 6.61661896
Number of Observations: 49916
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
317 49916
summary(modonlyTtrendJbetasimpreml)
Linear mixed-effects model fit by REML
Data: trends[i2, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.05659393 (Intr)
temptrend_abs.sc 0.02520050 0.021
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 1.693577e-06 0.3590015
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.413558
Fixed effects: Jbetatrend ~ abs(temptrend) * REALM
Correlation:
(Intr) abs(t) REALMM REALMT a():REALMM
abs(temptrend) -0.160
REALMMarine -0.928 0.148
REALMTerrestrial -0.931 0.149 0.864
abs(temptrend):REALMMarine 0.158 -0.991 -0.150 -0.147
abs(temptrend):REALMTerrestrial 0.157 -0.986 -0.146 -0.151 0.976
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-7.8997139 -0.1696297 0.2037637 0.6704994 6.6449583
Number of Observations: 49916
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
317 49916
summary(modonlyTtrendHornsimpreml)
Linear mixed-effects model fit by REML
Data: trends[i3, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.05792109 (Intr)
temptrend_abs.sc 0.02134495 0.134
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.007146559 0.306766
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.217277
Fixed effects: Horntrend ~ abs(temptrend) * REALM
Correlation:
(Intr) abs(t) REALMM REALMT a():REALMM
abs(temptrend) -0.154
REALMMarine -0.914 0.141
REALMTerrestrial -0.925 0.143 0.845
abs(temptrend):REALMMarine 0.153 -0.989 -0.142 -0.141
abs(temptrend):REALMTerrestrial 0.152 -0.984 -0.139 -0.146 0.973
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-6.16836348 -0.32501087 0.06399723 0.53830958 5.96234033
Number of Observations: 48800
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
276 48800
# make table of coefficients
coefs <- as.data.frame(summary(modonlyTtrend)$tTable)
coefs2 <- as.data.frame(summary(modonlyTtrendJbeta)$tTable)
coefs3 <- as.data.frame(summary(modonlyTtrendHorn)$tTable)
coefs$mod <- 'Jtu'
coefs2$mod <- 'Jbeta'
coefs3$mod <- 'Horn'
rows1 <- which(grepl('temptrend', rownames(coefs))) # extract temperature effect
cols <- c('Value', 'Std.Error', 'mod')
allcoefs <- rbind(coefs[rows1, cols], coefs2[rows1, cols], coefs3[rows1, cols])
allcoefs$Value[grepl('REALMMarine', rownames(allcoefs))] <- allcoefs$Value[grepl('REALMMarine', rownames(allcoefs))] +
allcoefs$Value[!grepl('REALM', rownames(allcoefs))] # add intercept to marine effects
allcoefs$Value[grepl('REALMTerrestrial', rownames(allcoefs))] <- allcoefs$Value[grepl('REALMTerrestrial', rownames(allcoefs))] +
allcoefs$Value[!grepl('REALM', rownames(allcoefs))] # add intercept to marine effects
allcoefs$lCI <- allcoefs$Value - allcoefs$Std.Error # lower confidence interval
allcoefs$uCI <- allcoefs$Value + allcoefs$Std.Error
allcoefs$y <- c(3, 2, 1, 2.9, 1.9, 0.9, 2.8, 1.8, 0.8) # y-values
allcoefs$col <- c(rep('black', 3), rep('light grey', 3), rep('dark grey', 3))
allcoefs$realm <- rep(c('Freshwater', 'Marine', 'Terrestrial'), 3)
par(las = 1, mai = c(0.8, 2, 0.1, 0.1))
plot(0,0, col = 'white', xlim=c(-0.02, 0.85), ylim = c(0.7,3),
yaxt='n', xlab = 'Turnover per |°C/yr|', ylab ='')
axis(2, at = 3:1, labels = c('Freshwater', 'Marine', 'Terrestrial'), cex.axis = 0.7)
abline(v = 0, col = 'grey')
for(i in 1:nrow(allcoefs)){
with(allcoefs[i, ], points(Value, y, pch = 16, col = col))
with(allcoefs[i, ], lines(x = c(lCI, uCI), y = c(y, y), col = col))
}
legend('bottomright', col = c('black', 'dark grey', 'light grey'), lwd = 1, pch = 16,
legend = c('Jaccard turnover', 'Jaccard total', 'Horn-Morisita'))
Scatterplot, violin plots, and coefficient plots all together
trends[temptrend <= -0.5, temptrendtext := 'Cooling']
trends[abs(temptrend) <= 0.1, temptrendtext := 'Stable']
trends[temptrend >= 0.5, temptrendtext := 'Warming']
trends[abs(rarefyID_y) < 35, latzone := 'Subtropics']
trends[abs(rarefyID_y) >= 35 & abs(rarefyID_x) < 66.56339, latzone := 'Temperate']
trends[abs(rarefyID_y) >= 66.56339, latzone := 'Polar']
trends[, latzone := factor(latzone, levels = c('Subtropics', 'Temperate', 'Polar'))]
p1 <- ggplot(trends, aes(temptrend, Jtutrend, color = REALM, fill = REALM, size = nyrBT)) +
geom_point(na.rm = TRUE, shape = 16, alpha = 0.1) +
geom_smooth(data=subset(trends, abs(temptrend) < 0.75), method = 'gam', formula = y ~ s(x, bs = "cs"),
na.rm = TRUE) +
scale_color_brewer(palette="Set1", name = 'Realm') +
scale_fill_brewer(palette="Set1", name = 'Realm') +
labs(x = 'Temperature trend (°C/yr)', y = 'Jaccard turnover', tag = 'A') +
scale_size_continuous(range = c(1, 8), breaks = c(2, 5, 20)) +
guides(size = guide_legend(title = 'Years',
override.aes = list(linetype=0, fill = NA, alpha = 1))) +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.key=element_blank(),
legend.key.size = unit(0.5,"line"),
axis.text=element_text(size=8),
axis.title=element_text(size=10))
p2 <- ggplot(trends[!is.na(temptrendtext), ], aes(temptrendtext, Jtutrend)) +
geom_violin(draw_quantiles = c(0.25, 0.5, 0.75), fill = 'grey') +
labs(x = '', y = 'Jaccard turnover', tag = 'B') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.key=element_blank(),
axis.text=element_text(size=8),
axis.title=element_text(size=10))
p3 <- ggplot(trends[abs(temptrend) >= 0.5 & !is.na(latzone), ], aes(latzone, Jtutrend)) +
geom_violin(draw_quantiles = c(0.25, 0.5, 0.75), fill = 'grey') +
labs(x = '', y = '', tag = 'C') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.key=element_blank(),
axis.text=element_text(size=7),
axis.title=element_text(size=10))
p4 <- ggplot(allcoefs, aes(Value, y, group = mod, color = mod)) +
geom_errorbarh(aes(xmin = lCI, xmax = uCI, height = 0)) +
geom_point() +
labs(x = expression(atop('Temperature change effect', '(Turnover '~degree*'C'^'-1'*')')), y = '', tag = 'D') +
scale_color_grey() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.position='none',
axis.text=element_text(size=7),
axis.title=element_text(size=7)) +
coord_cartesian(xlim =c(0, 1)) +
scale_y_continuous(name = '', breaks = c(1, 2, 3), labels = c('Terrestrial', 'Marine', 'Freshwater'))
grid.arrange(p1, p2, p3, p4, ncol = 3, layout_matrix = rbind(c(1,1,1), c(2,3,4)),
heights=c(unit(0.66, "npc"), unit(0.34, "npc")))
Try static covariates plus interactions of abs temperature trend with each covariate:
Except for thermal bias: interact with temperature trend (not abs)
i <- trends[, complete.cases(Jtutrend, REALM, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc,
temptrend.sc, temptrend_abs.sc, mass.sc, speed.sc, lifespan.sc,
consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc, human.sc)]
randef <- list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1)
varef <- varPower(-0.5, ~nyrBT)
if(file.exists('temp/modTfull1.rds')){
modTfull1 <- readRDS('temp/modTfull1.rds')
} else {
modTfull1 <- lme(Jtutrend ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tempave.sc +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*lifespan.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*endothermfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend.sc*thermal_bias.sc +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*human.sc*REALM,
random = randef, weights = varef, data = trends[i,], method = 'REML')
saveRDS(modTfull1, file = 'temp/modTfull1.rds')
}
summary(modTfull1)
Linear mixed-effects model fit by REML
Data: trends[i, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.05028541 (Intr)
temptrend_abs.sc 0.01934781 0.555
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.001189033 0.3037859
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.246996
Fixed effects: Jtutrend ~ temptrend_abs.sc * REALM + temptrend_abs.sc * tempave.sc + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * lifespan.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * endothermfrac.sc + temptrend_abs.sc * nspp.sc + temptrend.sc * thermal_bias.sc + temptrend_abs.sc * npp.sc + temptrend_abs.sc * human.sc * REALM
Correlation:
(Intr) tmpt_. REALMMr REALMTr tmpv.s tmpv_. ses.sc mcrcl. mss.sc spd.sc
temptrend_abs.sc 0.368
REALMMarine -0.918 -0.337
REALMTerrestrial -0.882 -0.333 0.807
tempave.sc 0.000 -0.007 -0.013 -0.003
tempave_metab.sc 0.053 0.015 -0.042 -0.045 -0.278
seas.sc -0.037 -0.004 0.053 -0.003 0.271 -0.083
microclim.sc -0.008 0.002 0.013 -0.010 0.049 0.067 0.170
mass.sc 0.019 0.000 -0.004 0.001 -0.002 -0.550 -0.046 -0.015
speed.sc 0.021 0.007 -0.034 -0.032 -0.003 0.170 -0.075 -0.032 -0.135
lifespan.sc 0.037 0.021 -0.024 -0.043 -0.037 0.752 0.094 0.047 -0.806 0.265
consumerfrac.sc -0.067 -0.057 0.074 0.342 -0.014 -0.090 0.004 0.007 0.063 -0.163
endothermfrac.sc 0.169 0.077 -0.087 -0.349 0.080 -0.167 0.048 -0.002 0.014 0.083
nspp.sc -0.023 0.000 -0.002 -0.014 -0.047 -0.021 -0.033 -0.056 -0.156 -0.050
temptrend.sc -0.005 -0.009 0.006 0.008 -0.060 -0.018 -0.044 -0.013 0.015 -0.011
thermal_bias.sc 0.030 -0.006 -0.044 -0.008 0.759 -0.044 -0.152 -0.131 0.039 0.019
npp.sc 0.004 0.000 -0.006 -0.001 -0.320 0.241 -0.256 -0.220 -0.011 -0.021
human.sc -0.166 -0.023 0.157 0.146 0.017 -0.005 0.008 0.017 0.006 0.004
temptrend_abs.sc:REALMMarine -0.349 -0.953 0.369 0.315 0.007 -0.009 0.014 0.001 0.006 -0.011
temptrend_abs.sc:REALMTerrestrial -0.327 -0.874 0.301 0.367 -0.007 -0.016 -0.020 -0.012 0.012 -0.010
temptrend_abs.sc:tempave.sc 0.001 -0.004 -0.002 -0.003 0.099 -0.059 0.036 -0.028 -0.035 -0.031
temptrend_abs.sc:tempave_metab.sc 0.009 0.032 -0.004 -0.005 0.033 0.330 0.018 0.085 -0.207 0.074
temptrend_abs.sc:seas.sc 0.012 -0.029 -0.008 -0.023 0.153 0.024 0.227 0.027 -0.039 -0.029
temptrend_abs.sc:microclim.sc -0.004 -0.032 0.001 -0.002 0.012 0.099 0.059 0.312 -0.033 0.008
temptrend_abs.sc:mass.sc -0.001 -0.002 0.007 0.009 -0.016 -0.272 -0.038 -0.024 0.459 -0.043
temptrend_abs.sc:speed.sc -0.001 -0.004 0.000 -0.005 -0.009 0.028 -0.028 0.002 -0.014 0.180
temptrend_abs.sc:lifespan.sc 0.009 0.040 -0.003 -0.010 0.000 0.378 0.049 0.026 -0.385 0.095
temptrend_abs.sc:consumerfrac.sc -0.050 -0.058 0.050 0.124 -0.008 -0.067 -0.005 -0.003 0.037 -0.055
lfspn. cnsmr. endth. nspp.s tmptr. thrm_. npp.sc hmn.sc tm_.:REALMM
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc -0.123
endothermfrac.sc -0.014 -0.440
nspp.sc 0.098 0.014 0.057
temptrend.sc -0.012 0.011 0.002 0.015
thermal_bias.sc -0.067 0.001 -0.006 -0.106 -0.001
npp.sc 0.059 -0.047 -0.090 -0.162 -0.012 -0.137
human.sc 0.007 0.013 -0.002 -0.015 0.008 0.016 -0.029
temptrend_abs.sc:REALMMarine -0.015 0.060 -0.051 -0.007 0.006 0.005 -0.008 0.023
temptrend_abs.sc:REALMTerrestrial -0.022 0.139 -0.130 -0.015 0.009 0.001 0.013 0.020 0.829
temptrend_abs.sc:tempave.sc 0.005 -0.005 0.024 -0.002 -0.071 0.016 -0.031 -0.004 0.003
temptrend_abs.sc:tempave_metab.sc 0.300 -0.034 -0.060 -0.025 0.001 0.090 0.027 0.003 -0.023
temptrend_abs.sc:seas.sc 0.042 0.016 0.002 -0.006 -0.029 0.098 -0.178 -0.003 0.054
temptrend_abs.sc:microclim.sc 0.022 0.002 -0.032 0.005 0.003 -0.029 -0.141 0.002 0.042
temptrend_abs.sc:mass.sc -0.385 0.037 0.006 -0.056 0.019 0.014 0.007 0.009 0.015
temptrend_abs.sc:speed.sc 0.051 -0.041 0.027 -0.024 -0.006 0.010 0.012 0.012 -0.024
temptrend_abs.sc:lifespan.sc 0.475 -0.057 -0.035 0.040 -0.015 -0.014 0.016 -0.001 -0.033
temptrend_abs.sc:consumerfrac.sc -0.077 0.278 -0.127 0.008 0.009 -0.009 -0.018 -0.011 0.071
tm_.:REALMT tmptrnd_bs.sc:t. t_.:_. tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave.sc 0.003
temptrend_abs.sc:tempave_metab.sc -0.030 -0.639
temptrend_abs.sc:seas.sc -0.050 0.206 0.017
temptrend_abs.sc:microclim.sc -0.002 -0.039 0.010 0.048
temptrend_abs.sc:mass.sc 0.027 -0.059 -0.424 -0.029 0.014
temptrend_abs.sc:speed.sc -0.008 -0.042 0.093 -0.037 -0.038
temptrend_abs.sc:lifespan.sc -0.040 -0.003 0.633 0.055 0.013
temptrend_abs.sc:consumerfrac.sc 0.267 0.023 -0.114 -0.029 0.008
tmptrnd_bs.sc:ms. tmptrnd_bs.sc:sp. tmptrnd_bs.sc:l. tmptrnd_bs.sc:c.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc -0.059
temptrend_abs.sc:lifespan.sc -0.805 0.150
temptrend_abs.sc:consumerfrac.sc 0.062 -0.234 -0.147
tmptrnd_bs.sc:nd. tmptrnd_bs.sc:ns. tm.:_. tmptrnd_bs.sc:np.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:lifespan.sc
temptrend_abs.sc:consumerfrac.sc
tmptrnd_bs.sc:h. REALMM: REALMT: t_.:REALMM:
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:lifespan.sc
temptrend_abs.sc:consumerfrac.sc
[ reached getOption("max.print") -- omitted 9 rows ]
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-7.58461466 -0.34521721 0.05131203 0.55413461 6.93144917
Number of Observations: 43585
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
250 43585
i <- trends[, complete.cases(Jtutrend, REALM, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc,
temptrend.sc, temptrend_abs.sc, mass.sc, speed.sc, lifespan.sc,
consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc, human.sc)]
randef <- list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1)
varef <- varPower(-0.5, ~nyrBT)
if(file.exists('temp/modTfull1simpreml.rds')){
modTfull1simpreml <- readRDS('temp/modTfull1simpreml.rds')
} else {
require(MASS) # for stepAIC
modTfull1ml <- update(modTfull1, method = 'ML')
modTfull1simp <- stepAIC(modTfull1ml, direction = 'backward')
modTfull1simpreml <- update(modTfull1simp, method = 'REML')
saveRDS(modTfull1simpreml, file = 'temp/modTfull1simpreml.rds')
}
summary(modTfull1simpreml)
Linear mixed-effects model fit by REML
Data: trends[i, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.05008648 (Intr)
temptrend_abs.sc 0.01884335 0.56
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.001194902 0.3037795
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.246946
Fixed effects: Jtutrend ~ temptrend_abs.sc + REALM + tempave.sc + tempave_metab.sc + seas.sc + microclim.sc + mass.sc + speed.sc + lifespan.sc + endothermfrac.sc + nspp.sc + temptrend.sc + thermal_bias.sc + npp.sc + human.sc + temptrend_abs.sc:REALM + temptrend_abs.sc:tempave_metab.sc + temptrend_abs.sc:seas.sc + temptrend_abs.sc:microclim.sc + temptrend_abs.sc:mass.sc + temptrend_abs.sc:lifespan.sc + temptrend_abs.sc:nspp.sc + temptrend.sc:thermal_bias.sc + temptrend_abs.sc:npp.sc + temptrend_abs.sc:human.sc + REALM:human.sc + temptrend_abs.sc:REALM:human.sc
Correlation:
(Intr) tmpt_. REALMMr REALMTr tmpv.s tmpv_. ses.sc mcrcl. mss.sc spd.sc
temptrend_abs.sc 0.360
REALMMarine -0.918 -0.333
REALMTerrestrial -0.916 -0.325 0.835
tempave.sc 0.004 0.005 -0.014 -0.005
tempave_metab.sc 0.052 0.023 -0.037 -0.023 -0.289
seas.sc -0.036 0.000 0.053 -0.006 0.268 -0.084
microclim.sc -0.005 0.007 0.012 -0.016 0.049 0.063 0.171
mass.sc 0.022 0.000 -0.009 -0.020 0.006 -0.551 -0.045 -0.015
speed.sc 0.013 0.005 -0.025 0.022 -0.003 0.154 -0.072 -0.034 -0.128
lifespan.sc 0.032 0.024 -0.015 -0.006 -0.047 0.750 0.095 0.046 -0.807 0.246
endothermfrac.sc 0.145 0.007 -0.055 -0.222 0.123 -0.212 0.070 0.017 0.037 0.023
nspp.sc -0.026 -0.009 -0.002 -0.014 -0.042 -0.013 -0.032 -0.053 -0.161 -0.043
temptrend.sc -0.006 -0.013 0.006 0.007 -0.050 -0.018 -0.041 -0.014 0.010 -0.009
thermal_bias.sc 0.035 0.007 -0.047 -0.016 0.760 -0.053 -0.156 -0.135 0.043 0.016
npp.sc 0.001 -0.002 -0.003 0.015 -0.322 0.237 -0.255 -0.221 -0.009 -0.032
human.sc -0.167 -0.020 0.157 0.152 0.018 -0.005 0.009 0.017 0.005 0.004
temptrend_abs.sc:REALMMarine -0.341 -0.955 0.364 0.308 0.000 -0.009 0.011 -0.002 0.004 -0.001
temptrend_abs.sc:REALMTerrestrial -0.319 -0.896 0.299 0.337 -0.029 -0.021 -0.027 -0.024 0.008 -0.001
temptrend_abs.sc:tempave_metab.sc 0.025 0.081 -0.008 -0.016 0.103 0.365 0.049 0.080 -0.302 0.047
temptrend_abs.sc:seas.sc 0.019 -0.014 -0.010 -0.039 0.126 0.026 0.222 0.029 -0.029 -0.017
temptrend_abs.sc:microclim.sc -0.005 -0.036 0.001 -0.001 0.017 0.100 0.060 0.312 -0.036 0.015
temptrend_abs.sc:mass.sc 0.002 -0.001 0.003 -0.004 -0.008 -0.273 -0.037 -0.025 0.457 -0.030
temptrend_abs.sc:lifespan.sc 0.009 0.050 0.001 0.003 -0.011 0.367 0.050 0.022 -0.385 0.064
temptrend_abs.sc:nspp.sc -0.008 0.021 -0.002 0.001 -0.028 0.014 0.001 0.013 -0.070 0.029
temptrend.sc:thermal_bias.sc 0.009 0.019 -0.008 -0.007 0.067 0.033 0.000 -0.032 -0.002 0.008
temptrend_abs.sc:npp.sc 0.002 -0.054 -0.007 0.012 -0.115 0.095 -0.161 -0.163 0.013 0.000
temptrend_abs.sc:human.sc -0.070 0.160 0.066 0.063 -0.004 -0.009 0.005 0.006 0.009 -0.007
REALMMarine:human.sc 0.167 0.021 -0.158 -0.152 -0.020 0.004 -0.017 -0.024 -0.005 -0.003
REALMTerrestrial:human.sc 0.166 0.020 -0.157 -0.152 -0.032 0.007 -0.022 -0.006 -0.002 -0.001
temptrend_abs.sc:REALMMarine:human.sc 0.070 -0.158 -0.066 -0.063 0.001 0.009 -0.009 -0.009 -0.009 0.007
temptrend_abs.sc:REALMTerrestrial:human.sc 0.069 -0.160 -0.066 -0.063 0.012 0.007 -0.003 -0.005 -0.008 0.006
lfspn. endth. nspp.s tmptr. thrm_. npp.sc hmn.sc tm_.:REALMM tm_.:REALMT
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
endothermfrac.sc -0.054
nspp.sc 0.107 0.051
temptrend.sc -0.007 -0.002 0.013
thermal_bias.sc -0.075 0.028 -0.100 0.003
npp.sc 0.053 -0.129 -0.161 -0.013 -0.139
human.sc 0.008 0.006 -0.015 0.008 0.015 -0.029
temptrend_abs.sc:REALMMarine -0.011 0.005 -0.003 0.008 -0.003 -0.006 0.020
temptrend_abs.sc:REALMTerrestrial -0.017 0.019 0.000 0.015 -0.023 0.020 0.019 0.855
temptrend_abs.sc:tempave_metab.sc 0.385 0.027 -0.011 -0.049 0.108 0.003 -0.001 -0.048 -0.098
temptrend_abs.sc:seas.sc 0.035 0.053 0.001 -0.011 0.087 -0.178 -0.003 0.046 -0.082
temptrend_abs.sc:microclim.sc 0.025 -0.043 0.003 0.000 -0.026 -0.142 0.002 0.044 0.002
temptrend_abs.sc:mass.sc -0.381 0.023 -0.060 0.013 0.017 0.008 0.010 0.011 0.017
temptrend_abs.sc:lifespan.sc 0.466 -0.031 0.053 -0.010 -0.027 0.011 -0.004 -0.032 -0.038
temptrend_abs.sc:nspp.sc 0.076 -0.029 0.303 0.015 -0.051 -0.017 -0.011 -0.053 -0.039
temptrend.sc:thermal_bias.sc 0.003 0.008 -0.010 -0.402 -0.015 -0.003 -0.006 -0.017 -0.020
temptrend_abs.sc:npp.sc 0.010 -0.062 -0.034 -0.016 -0.044 0.366 -0.012 0.040 0.053
temptrend_abs.sc:human.sc -0.008 0.000 -0.003 0.007 -0.008 -0.012 0.409 -0.151 -0.139
REALMMarine:human.sc -0.009 -0.006 0.013 -0.008 -0.014 0.018 -0.998 -0.021 -0.019
REALMTerrestrial:human.sc -0.013 -0.011 0.018 -0.007 -0.020 0.027 -0.998 -0.020 -0.019
temptrend_abs.sc:REALMMarine:human.sc 0.008 0.000 0.000 -0.006 0.006 0.008 -0.408 0.150 0.139
temptrend_abs.sc:REALMTerrestrial:human.sc 0.008 0.002 0.004 -0.007 0.011 0.013 -0.406 0.151 0.138
t_.:_. tmptrnd_bs.sc:s. tmptrnd_bs.sc:mc. tmptrnd_bs.sc:ms.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc 0.170
temptrend_abs.sc:microclim.sc -0.012 0.058
temptrend_abs.sc:mass.sc -0.626 -0.016 0.009
temptrend_abs.sc:lifespan.sc 0.829 0.045 0.021 -0.813
temptrend_abs.sc:nspp.sc 0.080 -0.056 -0.174 -0.224
temptrend.sc:thermal_bias.sc 0.072 -0.030 -0.036 -0.004
temptrend_abs.sc:npp.sc 0.046 -0.169 -0.213 -0.032
temptrend_abs.sc:human.sc -0.030 -0.018 0.038 0.049
REALMMarine:human.sc 0.001 -0.001 -0.005 -0.009
REALMTerrestrial:human.sc -0.001 -0.002 0.001 -0.008
temptrend_abs.sc:REALMMarine:human.sc 0.030 0.009 -0.037 -0.048
temptrend_abs.sc:REALMTerrestrial:human.sc 0.023 0.014 -0.027 -0.045
tmptrnd_bs.sc:l. tmptrnd_bs.sc:ns. tm.:_. tmptrnd_bs.sc:np.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:lifespan.sc
temptrend_abs.sc:nspp.sc 0.231
temptrend.sc:thermal_bias.sc -0.004 0.002
temptrend_abs.sc:npp.sc 0.042 -0.188 0.001
temptrend_abs.sc:human.sc -0.027 -0.032 -0.004 -0.034
REALMMarine:human.sc 0.003 0.010 0.005 0.008
REALMTerrestrial:human.sc 0.002 0.013 0.004 0.012
temptrend_abs.sc:REALMMarine:human.sc 0.027 0.028 0.005 0.024
temptrend_abs.sc:REALMTerrestrial:human.sc 0.021 0.033 0.006 0.030
tmptrnd_bs.sc:h. REALMM: REALMT: t_.:REALMM:
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:lifespan.sc
temptrend_abs.sc:nspp.sc
temptrend.sc:thermal_bias.sc
temptrend_abs.sc:npp.sc
temptrend_abs.sc:human.sc
REALMMarine:human.sc -0.408
REALMTerrestrial:human.sc -0.408 0.997
temptrend_abs.sc:REALMMarine:human.sc -0.998 0.409 0.407
temptrend_abs.sc:REALMTerrestrial:human.sc -0.993 0.405 0.404 0.991
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-7.59387150 -0.34529883 0.05138559 0.55509022 6.91268058
Number of Observations: 43585
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
250 43585
coefs <- summary(modTfull1simpreml)$tTable
par(las = 1, mai = c(0.5, 3, 0.1, 0.1))
rows1 <- which(!grepl('Intercept', rownames(coefs)))
plot(0,0, col = 'white', xlim=c(-0.02, 0.08), ylim = c(1,length(rows1)), yaxt='n', xlab = '', ylab ='')
axis(2, at = length(rows1):1, labels = rownames(coefs)[rows1], cex.axis = 0.7)
abline(v = 0, col = 'grey')
for(i in 1:length(rows1)){
x = coefs[rows1[i], 1]
se = coefs[rows1[i], 2]
points(x, length(rows1) + 1 - i, pch = 16)
lines(x = c(x-se, x+se), y = c(length(rows1) + 1 - i, length(rows1) + 1 - i))
}
resids <- resid(modTfull1simpreml)
preds <- getData(modTfull1simpreml)
col = '#00000033'
cex = 0.5
par(mfrow = c(4,4))
boxplot(resids ~ preds$REALM, cex = cex, col = col)
plot(preds$temptrend_abs.sc, resids, cex = cex, col = col)
plot(preds$temptrend.sc, resids, cex = cex, col = col)
plot(preds$tempave.sc, resids, cex = cex, col = col)
plot(preds$tempave_metab.sc, resids, cex = cex, col = col)
plot(preds$seas.sc, resids, cex = cex, col = col)
plot(preds$microclim.sc, resids, cex = cex, col = col)
plot(preds$mass.sc, resids, cex = cex, col = col)
plot(preds$speed.sc, resids, cex = cex, col = col)
plot(preds$lifespan.sc, resids, cex = cex, col = col)
plot(preds$consumerfrac.sc, resids, cex = cex, col = col)
plot(preds$endothermfrac.sc, resids, cex = cex, col = col)
plot(preds$nspp.sc, resids, cex = cex, col = col)
plot(preds$thermal_bias.sc, resids, cex = cex, col = col)
plot(preds$npp.sc, resids, cex = cex, col = col)
plot(preds$human.sc, resids, cex = cex, col = col)
i2 <- trends[, complete.cases(Jbetatrend, REALM, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc,
temptrend.sc, temptrend_abs.sc, mass.sc, speed.sc, lifespan.sc,
consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc, human.sc)]
i3 <- trends[, complete.cases(Horntrend, REALM, tempave.sc, tempave_metab.sc, seas.sc, microclim.sc,
temptrend.sc, temptrend_abs.sc, mass.sc, speed.sc, lifespan.sc,
consumerfrac.sc, endothermfrac.sc, nspp.sc, thermal_bias.sc, npp.sc, human.sc)]
randef <- list(STUDY_ID = ~ temptrend_abs.sc, rarefyID = ~1)
varef <- varPower(-0.5, ~nyrBT)
# full models
if(file.exists('temp/modTfullJbeta.rds')){
modTfullJbeta <- readRDS('temp/modTfullJbeta.rds')
} else {
modTfullJbeta <- lme(Jbetatrend ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tempave.sc +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*lifespan.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*endothermfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend.sc*thermal_bias.sc +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*human.sc*REALM,
random = randef, weights = varef, data = trends[i2,], method = 'REML')
saveRDS(modTfullJbeta, file = 'temp/modTfullJbeta.rds')
}
if(file.exists('temp/modTfullHorn.rds')){
modTfullHorn <- readRDS('temp/modTfullHorn.rds')
} else {
modTfullHorn <- lme(Horntrend ~ temptrend_abs.sc*REALM +
temptrend_abs.sc*tempave.sc +
temptrend_abs.sc*tempave_metab.sc +
temptrend_abs.sc*seas.sc +
temptrend_abs.sc*microclim.sc +
temptrend_abs.sc*mass.sc +
temptrend_abs.sc*speed.sc +
temptrend_abs.sc*lifespan.sc +
temptrend_abs.sc*consumerfrac.sc +
temptrend_abs.sc*endothermfrac.sc +
temptrend_abs.sc*nspp.sc +
temptrend.sc*thermal_bias.sc +
temptrend_abs.sc*npp.sc +
temptrend_abs.sc*human.sc*REALM,
random = randef, weights = varef, data = trends[i3,], method = 'REML')
saveRDS(modTfullHorn, file = 'temp/modTfullHorn.rds')
}
summary(modTfullJbeta)
Linear mixed-effects model fit by REML
Data: trends[i2, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.06574154 (Intr)
temptrend_abs.sc 0.02529340 0.519
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.002266703 0.3555714
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.375398
Fixed effects: Jbetatrend ~ temptrend_abs.sc * REALM + temptrend_abs.sc * tempave.sc + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * lifespan.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * endothermfrac.sc + temptrend_abs.sc * nspp.sc + temptrend.sc * thermal_bias.sc + temptrend_abs.sc * npp.sc + temptrend_abs.sc * human.sc * REALM
Correlation:
(Intr) tmpt_. REALMMr REALMTr tmpv.s tmpv_. ses.sc mcrcl. mss.sc spd.sc
temptrend_abs.sc 0.344
REALMMarine -0.918 -0.315
REALMTerrestrial -0.886 -0.314 0.812
tempave.sc -0.002 -0.006 -0.009 -0.006
tempave_metab.sc 0.042 0.013 -0.032 -0.036 -0.264
seas.sc -0.026 -0.002 0.038 -0.002 0.282 -0.083
microclim.sc -0.004 0.002 0.010 -0.007 0.062 0.066 0.188
mass.sc 0.018 0.002 -0.005 -0.003 0.000 -0.550 -0.041 -0.013
speed.sc 0.016 0.006 -0.025 -0.022 -0.005 0.180 -0.080 -0.037 -0.138
lifespan.sc 0.027 0.016 -0.017 -0.033 -0.036 0.757 0.095 0.049 -0.801 0.280
consumerfrac.sc -0.050 -0.051 0.062 0.323 -0.034 -0.067 0.003 0.013 0.053 -0.123
endothermfrac.sc 0.157 0.075 -0.079 -0.320 0.057 -0.125 0.044 0.004 0.023 0.061
nspp.sc -0.020 0.001 0.000 -0.009 -0.048 -0.034 -0.026 -0.059 -0.150 -0.048
temptrend.sc -0.004 -0.008 0.005 0.007 -0.065 -0.019 -0.048 -0.017 0.015 -0.011
thermal_bias.sc 0.022 -0.006 -0.033 -0.008 0.757 -0.033 -0.152 -0.127 0.038 0.018
npp.sc 0.003 0.001 -0.007 -0.007 -0.322 0.246 -0.265 -0.223 -0.013 -0.023
human.sc -0.131 -0.012 0.123 0.116 0.020 -0.009 0.013 0.017 0.003 0.001
temptrend_abs.sc:REALMMarine -0.327 -0.953 0.347 0.299 0.006 -0.008 0.010 0.000 0.004 -0.010
temptrend_abs.sc:REALMTerrestrial -0.307 -0.878 0.282 0.346 -0.004 -0.014 -0.015 -0.009 0.007 -0.007
temptrend_abs.sc:tempave.sc -0.001 -0.006 -0.001 -0.003 0.108 -0.063 0.050 -0.026 -0.033 -0.030
temptrend_abs.sc:tempave_metab.sc 0.008 0.027 -0.005 -0.004 0.031 0.353 0.014 0.086 -0.218 0.088
temptrend_abs.sc:seas.sc 0.010 -0.024 -0.005 -0.014 0.158 0.026 0.232 0.025 -0.036 -0.029
temptrend_abs.sc:microclim.sc -0.002 -0.023 0.000 -0.001 0.010 0.101 0.054 0.277 -0.029 0.009
temptrend_abs.sc:mass.sc 0.001 0.004 0.004 0.006 -0.013 -0.290 -0.034 -0.020 0.496 -0.054
temptrend_abs.sc:speed.sc 0.000 -0.002 -0.001 -0.005 -0.006 0.038 -0.029 0.004 -0.023 0.222
temptrend_abs.sc:lifespan.sc 0.007 0.031 -0.004 -0.008 -0.002 0.409 0.050 0.025 -0.409 0.122
temptrend_abs.sc:consumerfrac.sc -0.049 -0.055 0.047 0.121 -0.007 -0.057 -0.003 -0.003 0.030 -0.053
lfspn. cnsmr. endth. nspp.s tmptr. thrm_. npp.sc hmn.sc tm_.:REALMM
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc -0.103
endothermfrac.sc -0.012 -0.427
nspp.sc 0.085 0.006 0.043
temptrend.sc -0.012 0.012 0.003 0.020
thermal_bias.sc -0.065 -0.006 -0.003 -0.112 -0.001
npp.sc 0.063 -0.059 -0.080 -0.165 -0.015 -0.135
human.sc 0.005 0.010 0.001 -0.009 0.009 0.015 -0.034
temptrend_abs.sc:REALMMarine -0.012 0.054 -0.049 -0.007 0.006 0.005 -0.007 0.012
temptrend_abs.sc:REALMTerrestrial -0.017 0.134 -0.132 -0.013 0.008 0.002 0.008 0.010 0.833
temptrend_abs.sc:tempave.sc 0.003 -0.011 0.017 -0.003 -0.077 0.008 -0.033 -0.003 0.005
temptrend_abs.sc:tempave_metab.sc 0.319 -0.022 -0.053 -0.028 0.002 0.098 0.030 -0.001 -0.020
temptrend_abs.sc:seas.sc 0.041 0.028 0.007 -0.010 -0.033 0.101 -0.180 0.000 0.044
temptrend_abs.sc:microclim.sc 0.018 0.003 -0.028 -0.001 0.001 -0.022 -0.126 0.001 0.032
temptrend_abs.sc:mass.sc -0.409 0.034 0.007 -0.060 0.019 0.015 0.005 0.011 0.009
temptrend_abs.sc:speed.sc 0.070 -0.036 0.024 -0.025 -0.004 0.012 0.012 0.011 -0.020
temptrend_abs.sc:lifespan.sc 0.510 -0.047 -0.038 0.038 -0.016 -0.014 0.021 -0.005 -0.025
temptrend_abs.sc:consumerfrac.sc -0.067 0.251 -0.134 0.005 0.008 -0.005 -0.019 -0.007 0.072
tm_.:REALMT tmptrnd_bs.sc:t. t_.:_. tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave.sc 0.002
temptrend_abs.sc:tempave_metab.sc -0.024 -0.649
temptrend_abs.sc:seas.sc -0.035 0.245 -0.011
temptrend_abs.sc:microclim.sc -0.003 -0.024 -0.001 0.059
temptrend_abs.sc:mass.sc 0.014 -0.053 -0.407 -0.027 0.015
temptrend_abs.sc:speed.sc -0.005 -0.044 0.090 -0.046 -0.047
temptrend_abs.sc:lifespan.sc -0.031 -0.007 0.628 0.053 0.016
temptrend_abs.sc:consumerfrac.sc 0.258 0.013 -0.090 -0.017 0.010
tmptrnd_bs.sc:ms. tmptrnd_bs.sc:sp. tmptrnd_bs.sc:l. tmptrnd_bs.sc:c.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc -0.055
temptrend_abs.sc:lifespan.sc -0.790 0.150
temptrend_abs.sc:consumerfrac.sc 0.041 -0.188 -0.120
tmptrnd_bs.sc:nd. tmptrnd_bs.sc:ns. tm.:_. tmptrnd_bs.sc:np.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:lifespan.sc
temptrend_abs.sc:consumerfrac.sc
tmptrnd_bs.sc:h. REALMM: REALMT: t_.:REALMM:
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:lifespan.sc
temptrend_abs.sc:consumerfrac.sc
[ reached getOption("max.print") -- omitted 9 rows ]
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-6.8341663 -0.2345669 0.1396972 0.6505144 7.5323730
Number of Observations: 43585
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
250 43585
summary(modTfullHorn)
Linear mixed-effects model fit by REML
Data: trends[i3, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.06615737 (Intr)
temptrend_abs.sc 0.02037063 0.557
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.00442701 0.3182813
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.239152
Fixed effects: Horntrend ~ temptrend_abs.sc * REALM + temptrend_abs.sc * tempave.sc + temptrend_abs.sc * tempave_metab.sc + temptrend_abs.sc * seas.sc + temptrend_abs.sc * microclim.sc + temptrend_abs.sc * mass.sc + temptrend_abs.sc * speed.sc + temptrend_abs.sc * lifespan.sc + temptrend_abs.sc * consumerfrac.sc + temptrend_abs.sc * endothermfrac.sc + temptrend_abs.sc * nspp.sc + temptrend.sc * thermal_bias.sc + temptrend_abs.sc * npp.sc + temptrend_abs.sc * human.sc * REALM
Correlation:
(Intr) tmpt_. REALMMr REALMTr tmpv.s tmpv_. ses.sc mcrcl. mss.sc spd.sc
temptrend_abs.sc 0.336
REALMMarine -0.905 -0.302
REALMTerrestrial -0.876 -0.303 0.786
tempave.sc -0.002 -0.005 -0.008 -0.003
tempave_metab.sc 0.050 0.014 -0.037 -0.047 -0.337
seas.sc -0.039 -0.003 0.051 0.003 0.258 -0.087
microclim.sc -0.007 0.005 0.012 -0.008 0.027 0.057 0.138
mass.sc 0.017 -0.001 -0.004 0.002 -0.010 -0.525 -0.046 -0.009
speed.sc 0.017 0.005 -0.030 -0.026 -0.017 0.165 -0.089 -0.041 -0.133
lifespan.sc 0.034 0.021 -0.021 -0.040 -0.035 0.730 0.092 0.037 -0.802 0.256
consumerfrac.sc -0.051 -0.051 0.046 0.335 -0.014 -0.066 -0.003 0.010 0.052 -0.129
endothermfrac.sc 0.163 0.075 -0.079 -0.340 0.100 -0.159 0.042 0.000 0.013 0.065
nspp.sc -0.023 -0.001 0.000 -0.008 -0.044 -0.021 -0.028 -0.044 -0.163 -0.043
temptrend.sc -0.004 -0.007 0.005 0.008 -0.060 -0.016 -0.043 -0.013 0.016 -0.008
thermal_bias.sc 0.029 -0.004 -0.039 -0.013 0.726 -0.049 -0.151 -0.144 0.037 0.016
npp.sc 0.007 -0.002 -0.008 -0.007 -0.313 0.241 -0.273 -0.259 -0.010 -0.006
human.sc -0.144 0.005 0.134 0.127 0.019 -0.009 0.014 0.022 0.005 0.000
temptrend_abs.sc:REALMMarine -0.316 -0.951 0.339 0.285 0.004 -0.007 0.010 -0.003 0.006 -0.008
temptrend_abs.sc:REALMTerrestrial -0.297 -0.869 0.268 0.338 -0.006 -0.021 -0.018 -0.014 0.014 -0.007
temptrend_abs.sc:tempave.sc 0.001 0.002 -0.003 -0.001 0.087 -0.056 0.006 -0.035 -0.038 -0.029
temptrend_abs.sc:tempave_metab.sc 0.007 0.026 -0.001 -0.008 0.036 0.301 0.030 0.087 -0.190 0.063
temptrend_abs.sc:seas.sc 0.013 -0.019 -0.011 -0.020 0.117 0.031 0.181 0.007 -0.032 -0.024
temptrend_abs.sc:microclim.sc -0.003 -0.033 0.001 -0.003 -0.007 0.098 0.043 0.248 -0.026 0.017
temptrend_abs.sc:mass.sc -0.001 -0.005 0.006 0.009 -0.025 -0.249 -0.036 -0.018 0.443 -0.034
temptrend_abs.sc:speed.sc -0.002 -0.006 0.003 -0.003 -0.008 0.019 -0.019 0.010 -0.006 0.120
temptrend_abs.sc:lifespan.sc 0.008 0.037 0.000 -0.009 0.006 0.350 0.046 0.016 -0.368 0.078
temptrend_abs.sc:consumerfrac.sc -0.046 -0.059 0.048 0.104 -0.006 -0.057 -0.013 -0.006 0.035 -0.034
lfspn. cnsmr. endth. nspp.s tmptr. thrm_. npp.sc hmn.sc tm_.:REALMM
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc -0.101
endothermfrac.sc -0.012 -0.421
nspp.sc 0.100 0.010 0.049
temptrend.sc -0.012 0.010 0.001 0.018
thermal_bias.sc -0.067 0.007 0.006 -0.107 -0.005
npp.sc 0.056 -0.040 -0.077 -0.154 -0.016 -0.130
human.sc 0.006 0.013 0.000 -0.012 0.009 0.014 -0.038
temptrend_abs.sc:REALMMarine -0.014 0.052 -0.050 -0.005 0.005 0.003 -0.005 -0.005
temptrend_abs.sc:REALMTerrestrial -0.023 0.123 -0.125 -0.012 0.009 -0.003 0.013 -0.004 0.820
temptrend_abs.sc:tempave.sc 0.004 -0.005 0.024 -0.007 -0.068 0.028 -0.014 -0.003 -0.005
temptrend_abs.sc:tempave_metab.sc 0.281 -0.023 -0.054 -0.023 0.000 0.084 0.012 0.002 -0.015
temptrend_abs.sc:seas.sc 0.037 0.014 -0.007 -0.015 -0.025 0.091 -0.158 -0.003 0.044
temptrend_abs.sc:microclim.sc 0.012 -0.002 -0.032 0.016 0.009 -0.034 -0.134 0.000 0.042
temptrend_abs.sc:mass.sc -0.368 0.028 0.002 -0.051 0.021 0.007 0.009 0.008 0.016
temptrend_abs.sc:speed.sc 0.036 -0.026 0.018 -0.022 -0.005 0.009 0.016 0.011 -0.026
temptrend_abs.sc:lifespan.sc 0.456 -0.043 -0.034 0.036 -0.016 -0.008 0.012 -0.001 -0.031
temptrend_abs.sc:consumerfrac.sc -0.069 0.225 -0.103 0.005 0.010 -0.003 -0.007 -0.009 0.064
tm_.:REALMT tmptrnd_bs.sc:t. t_.:_. tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave.sc 0.004
temptrend_abs.sc:tempave_metab.sc -0.032 -0.660
temptrend_abs.sc:seas.sc -0.075 0.135 0.055
temptrend_abs.sc:microclim.sc -0.002 -0.061 0.014 0.037
temptrend_abs.sc:mass.sc 0.032 -0.064 -0.408 -0.024 0.016
temptrend_abs.sc:speed.sc -0.005 -0.046 0.092 -0.039 -0.043
temptrend_abs.sc:lifespan.sc -0.038 -0.006 0.620 0.051 0.011
temptrend_abs.sc:consumerfrac.sc 0.275 0.024 -0.107 -0.060 0.011
tmptrnd_bs.sc:ms. tmptrnd_bs.sc:sp. tmptrnd_bs.sc:l. tmptrnd_bs.sc:c.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc -0.059
temptrend_abs.sc:lifespan.sc -0.804 0.148
temptrend_abs.sc:consumerfrac.sc 0.068 -0.205 -0.136
tmptrnd_bs.sc:nd. tmptrnd_bs.sc:ns. tm.:_. tmptrnd_bs.sc:np.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:lifespan.sc
temptrend_abs.sc:consumerfrac.sc
tmptrnd_bs.sc:h. REALMM: REALMT: t_.:REALMM:
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:lifespan.sc
temptrend_abs.sc:consumerfrac.sc
[ reached getOption("max.print") -- omitted 9 rows ]
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-5.78006527 -0.36573591 0.04098243 0.55898457 6.73978237
Number of Observations: 42586
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
218 42586
require(MASS) # for stepAIC
# simplify
if(file.exists('temp/modTfullJbetasimpreml.rds')){
modTfullJbetasimpreml <- readRDS('temp/modTfullJbetasimpreml.rds')
} else {
modTfullJbetaml <- update(modTfullJbeta, method = 'ML')
modTfullJbetasimp <- stepAIC(modTfullJbetaml, direction = 'backward')
modTfullJbetasimpreml <- update(modTfullJbetasimp, method = 'REML')
saveRDS(modTfullJbetasimpreml, file = 'temp/modTfullJbetasimpreml.rds')
}
if(file.exists('temp/modTfullHornsimpreml.rds')){
modTfullHornsimpreml <- readRDS('temp/modTfullHornsimpreml.rds')
} else {
modTfullHornml <- update(modTfullHorn, method = 'ML')
modTfullHornsimp <- stepAIC(modTfullHornml, direction = 'backward')
modTfullHornsimpreml <- update(modTfullHornsimp, method = 'REML')
saveRDS(modTfullHornsimpreml, file = 'temp/modTfullHornsimpreml.rds')
}
summary(modTfullJbetasimpreml)
Linear mixed-effects model fit by REML
Data: trends[i2, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.06586673 (Intr)
temptrend_abs.sc 0.02513701 0.524
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.002270429 0.3556052
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.37548
Fixed effects: Jbetatrend ~ temptrend_abs.sc + REALM + tempave.sc + tempave_metab.sc + seas.sc + microclim.sc + mass.sc + speed.sc + lifespan.sc + consumerfrac.sc + endothermfrac.sc + nspp.sc + temptrend.sc + thermal_bias.sc + npp.sc + human.sc + temptrend_abs.sc:REALM + temptrend_abs.sc:tempave.sc + temptrend_abs.sc:tempave_metab.sc + temptrend_abs.sc:seas.sc + temptrend_abs.sc:microclim.sc + temptrend_abs.sc:mass.sc + temptrend_abs.sc:speed.sc + temptrend_abs.sc:lifespan.sc + temptrend_abs.sc:endothermfrac.sc + temptrend_abs.sc:nspp.sc + temptrend.sc:thermal_bias.sc + temptrend_abs.sc:npp.sc + temptrend_abs.sc:human.sc + REALM:human.sc + temptrend_abs.sc:REALM:human.sc
Correlation:
(Intr) tmpt_. REALMMr REALMTr tmpv.s tmpv_. ses.sc mcrcl. mss.sc spd.sc lfspn. cnsmr. endth. nspp.s tmptr. thrm_.
temptrend_abs.sc 0.346
REALMMarine -0.917 -0.317
REALMTerrestrial -0.887 -0.313 0.813
tempave.sc -0.002 -0.007 -0.009 -0.006
tempave_metab.sc 0.039 0.010 -0.029 -0.029 -0.265
seas.sc -0.026 -0.002 0.038 -0.002 0.282 -0.083
microclim.sc -0.004 0.002 0.010 -0.006 0.062 0.066 0.188
mass.sc 0.019 0.004 -0.006 -0.007 0.001 -0.549 -0.041 -0.013
speed.sc 0.013 0.003 -0.022 -0.016 -0.005 0.178 -0.080 -0.037 -0.136
lifespan.sc 0.023 0.012 -0.014 -0.026 -0.037 0.757 0.095 0.049 -0.801 0.277
consumerfrac.sc -0.039 -0.038 0.051 0.304 -0.033 -0.055 0.004 0.014 0.047 -0.113 -0.089
endothermfrac.sc 0.152 0.069 -0.073 -0.308 0.057 -0.134 0.044 0.004 0.027 0.054 -0.021 -0.409
nspp.sc -0.020 0.001 -0.001 -0.010 -0.048 -0.034 -0.026 -0.059 -0.150 -0.048 0.086 0.005 0.044
temptrend.sc -0.004 -0.007 0.004 0.006 -0.065 -0.019 -0.048 -0.017 0.015 -0.010 -0.012 0.011 0.004 0.020
thermal_bias.sc 0.022 -0.006 -0.032 -0.008 0.757 -0.033 -0.152 -0.127 0.038 0.017 -0.066 -0.005 -0.004 -0.112 -0.001
npp.sc 0.002 0.000 -0.006 -0.005 -0.322 0.245 -0.265 -0.224 -0.013 -0.024 0.062 -0.057 -0.084 -0.165 -0.015 -0.135
human.sc -0.131 -0.012 0.123 0.117 0.020 -0.009 0.013 0.017 0.003 0.001 0.005 0.012 0.000 -0.009 0.009 0.015
temptrend_abs.sc:REALMMarine -0.328 -0.953 0.348 0.295 0.006 -0.004 0.010 0.000 0.002 -0.006 -0.008 0.037 -0.040 -0.008 0.005 0.005
temptrend_abs.sc:REALMTerrestrial -0.308 -0.895 0.282 0.331 -0.003 0.001 -0.015 -0.008 -0.001 0.007 0.000 0.074 -0.102 -0.015 0.007 0.003
temptrend_abs.sc:tempave.sc 0.000 -0.005 -0.002 -0.005 0.108 -0.063 0.050 -0.026 -0.033 -0.030 0.004 -0.015 0.019 -0.003 -0.077 0.008
temptrend_abs.sc:tempave_metab.sc 0.004 0.022 0.000 0.007 0.031 0.350 0.013 0.086 -0.216 0.084 0.315 0.001 -0.066 -0.028 0.002 0.098
temptrend_abs.sc:seas.sc 0.009 -0.025 -0.004 -0.012 0.158 0.025 0.232 0.025 -0.035 -0.030 0.040 0.034 0.005 -0.010 -0.033 0.101
temptrend_abs.sc:microclim.sc -0.002 -0.022 0.000 -0.002 0.010 0.101 0.054 0.277 -0.029 0.009 0.019 0.001 -0.027 -0.001 0.000 -0.022
temptrend_abs.sc:mass.sc 0.003 0.006 0.002 0.001 -0.013 -0.288 -0.034 -0.020 0.496 -0.052 -0.407 0.025 0.013 -0.060 0.019 0.015
temptrend_abs.sc:speed.sc -0.009 -0.013 0.008 0.018 -0.007 0.028 -0.030 0.004 -0.017 0.216 0.059 0.012 -0.002 -0.025 -0.003 0.011
temptrend_abs.sc:lifespan.sc 0.002 0.024 0.002 0.007 -0.003 0.406 0.050 0.025 -0.409 0.117 0.507 -0.017 -0.055 0.039 -0.015 -0.015
temptrend_abs.sc:endothermfrac.sc 0.053 0.135 -0.024 -0.089 -0.030 -0.093 -0.003 -0.038 0.012 -0.007 -0.048 -0.091 0.356 0.046 -0.008 -0.064
temptrend_abs.sc:nspp.sc 0.000 0.029 -0.005 -0.011 -0.037 -0.012 0.003 0.004 -0.067 0.000 0.056 -0.008 0.019 0.333 0.022 -0.069
npp.sc hmn.sc tm_.:REALMM tm_.:REALMT tmptrnd_bs.sc:t. t_.:_. tmptrnd_bs.sc:ss. tmptrnd_bs.sc:mc.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc -0.034
temptrend_abs.sc:REALMMarine -0.006 0.012
temptrend_abs.sc:REALMTerrestrial 0.013 0.012 0.846
temptrend_abs.sc:tempave.sc -0.033 -0.003 0.004 -0.002
temptrend_abs.sc:tempave_metab.sc 0.029 -0.001 -0.013 -0.001 -0.650
temptrend_abs.sc:seas.sc -0.181 0.000 0.045 -0.032 0.245 -0.012
temptrend_abs.sc:microclim.sc -0.126 0.001 0.032 -0.006 -0.024 0.000 0.059
temptrend_abs.sc:mass.sc 0.006 0.011 0.006 0.003 -0.054 -0.405 -0.027 0.015
temptrend_abs.sc:speed.sc 0.008 0.010 -0.007 0.046 -0.043 0.075 -0.050 -0.046
temptrend_abs.sc:lifespan.sc 0.019 -0.006 -0.017 0.000 -0.006 0.624 0.051 0.017
temptrend_abs.sc:endothermfrac.sc -0.021 -0.002 -0.082 -0.242 0.393 -0.422 0.012 0.004
temptrend_abs.sc:nspp.sc -0.027 -0.012 -0.046 -0.061 0.044 -0.021 -0.045 -0.178
tmptrnd_bs.sc:ms. tmptrnd_bs.sc:sp. tmptrnd_bs.sc:l. tmptrnd_bs.sc:nd. tmptrnd_bs.sc:ns. tm.:_. tmptrnd_bs.sc:np.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc -0.048
temptrend_abs.sc:lifespan.sc -0.791 0.131
temptrend_abs.sc:endothermfrac.sc -0.009 0.073 -0.072
temptrend_abs.sc:nspp.sc -0.208 -0.146 0.176 0.107
tmptrnd_bs.sc:h. REALMM: REALMT: t_.:REALMM:
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
speed.sc
lifespan.sc
consumerfrac.sc
endothermfrac.sc
nspp.sc
temptrend.sc
thermal_bias.sc
npp.sc
human.sc
temptrend_abs.sc:REALMMarine
temptrend_abs.sc:REALMTerrestrial
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:microclim.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:speed.sc
temptrend_abs.sc:lifespan.sc
temptrend_abs.sc:endothermfrac.sc
temptrend_abs.sc:nspp.sc
[ reached getOption("max.print") -- omitted 7 rows ]
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-6.8331929 -0.2344594 0.1396617 0.6505383 7.5299389
Number of Observations: 43585
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
250 43585
summary(modTfullHornsimpreml)
Linear mixed-effects model fit by REML
Data: trends[i3, ]
Random effects:
Formula: ~temptrend_abs.sc | STUDY_ID
Structure: General positive-definite, Log-Cholesky parametrization
StdDev Corr
(Intercept) 0.06559547 (Intr)
temptrend_abs.sc 0.01968657 0.566
Formula: ~1 | rarefyID %in% STUDY_ID
(Intercept) Residual
StdDev: 0.00441256 0.3183541
Variance function:
Structure: Power of variance covariate
Formula: ~nyrBT
Parameter estimates:
power
-1.239254
Fixed effects: Horntrend ~ temptrend_abs.sc + REALM + tempave.sc + tempave_metab.sc + seas.sc + microclim.sc + mass.sc + lifespan.sc + endothermfrac.sc + nspp.sc + npp.sc + human.sc + temptrend_abs.sc:tempave.sc + temptrend_abs.sc:tempave_metab.sc + temptrend_abs.sc:seas.sc + temptrend_abs.sc:mass.sc + temptrend_abs.sc:lifespan.sc + temptrend_abs.sc:endothermfrac.sc + temptrend_abs.sc:nspp.sc + temptrend_abs.sc:npp.sc + temptrend_abs.sc:human.sc + REALM:human.sc
Correlation:
(Intr) tmpt_. REALMMr REALMTr tmpv.s tmpv_. ses.sc mcrcl. mss.sc lfspn. endth. nspp.s npp.sc hmn.sc tmptrnd_bs.sc:t.
temptrend_abs.sc 0.111
REALMMarine -0.896 0.057
REALMTerrestrial -0.906 -0.042 0.815
tempave.sc -0.038 -0.010 0.032 0.022
tempave_metab.sc 0.047 0.032 -0.030 -0.028 -0.454
seas.sc -0.036 -0.002 0.043 0.008 0.541 -0.088
microclim.sc -0.008 0.000 0.011 -0.008 0.196 0.037 0.109
mass.sc 0.025 0.020 -0.012 -0.018 -0.058 -0.513 -0.052 -0.004
lifespan.sc 0.027 0.036 -0.008 -0.011 0.027 0.722 0.108 0.039 -0.802
endothermfrac.sc 0.150 0.048 -0.064 -0.224 0.146 -0.211 0.046 0.015 0.039 -0.064
nspp.sc -0.024 -0.034 -0.004 -0.009 0.049 -0.020 -0.051 -0.068 -0.168 0.109 0.060
npp.sc 0.011 -0.002 -0.012 0.000 -0.327 0.258 -0.301 -0.261 -0.008 0.049 -0.108 -0.172
human.sc -0.112 -0.022 0.103 0.100 0.014 -0.003 0.015 0.030 0.000 0.013 0.009 -0.010 -0.037
temptrend_abs.sc:tempave.sc 0.001 -0.013 -0.003 0.000 0.092 -0.049 0.012 -0.016 -0.044 0.014 0.026 0.000 -0.013 -0.006
temptrend_abs.sc:tempave_metab.sc -0.007 0.056 0.016 0.009 -0.038 0.299 0.046 0.100 -0.188 0.280 -0.075 -0.012 0.022 0.013 -0.668
temptrend_abs.sc:seas.sc 0.012 -0.034 -0.029 -0.008 0.070 0.035 0.187 0.009 -0.038 0.051 -0.021 -0.011 -0.145 -0.005 0.148
temptrend_abs.sc:mass.sc 0.013 0.042 -0.007 -0.012 -0.045 -0.247 -0.039 -0.021 0.444 -0.371 0.019 -0.054 0.013 -0.012 -0.065
temptrend_abs.sc:lifespan.sc -0.008 0.060 0.020 0.015 0.022 0.343 0.053 0.011 -0.366 0.454 -0.060 0.043 0.011 0.010 0.001
temptrend_abs.sc:endothermfrac.sc 0.004 -0.039 -0.005 0.004 0.023 -0.105 -0.042 -0.068 0.005 -0.055 0.301 0.042 -0.006 0.005 0.543
temptrend_abs.sc:nspp.sc -0.028 -0.096 0.018 0.023 0.012 0.009 -0.014 0.057 -0.061 0.053 0.001 0.283 -0.036 0.003 0.053
temptrend_abs.sc:npp.sc 0.022 -0.047 -0.026 -0.014 -0.105 0.117 -0.145 -0.101 0.012 0.010 -0.054 -0.018 0.308 -0.006 -0.162
temptrend_abs.sc:human.sc -0.012 0.008 0.019 0.011 0.001 -0.019 -0.022 -0.042 0.009 -0.006 0.018 -0.029 -0.040 0.029 -0.176
REALMMarine:human.sc 0.113 0.023 -0.103 -0.100 -0.020 0.003 -0.025 -0.037 0.001 -0.014 -0.008 0.008 0.025 -0.998 0.004
REALMTerrestrial:human.sc 0.112 0.022 -0.103 -0.100 -0.033 0.007 -0.031 -0.016 0.005 -0.019 -0.014 0.013 0.034 -0.997 0.007
t_.:_. tmptrnd_bs.sc:s. tmptrnd_bs.sc:m. tmptrnd_bs.sc:l. tmptrnd_bs.sc:nd. tmptrnd_bs.sc:ns. tmptrnd_bs.sc:np.
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
lifespan.sc
endothermfrac.sc
nspp.sc
npp.sc
human.sc
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc 0.044
temptrend_abs.sc:mass.sc -0.407 -0.024
temptrend_abs.sc:lifespan.sc 0.616 0.060 -0.807
temptrend_abs.sc:endothermfrac.sc -0.569 -0.083 -0.019 -0.098
temptrend_abs.sc:nspp.sc -0.004 -0.035 -0.221 0.217 0.127
temptrend_abs.sc:npp.sc 0.145 -0.234 -0.022 0.051 -0.077 -0.259
temptrend_abs.sc:human.sc 0.101 -0.175 0.034 -0.032 -0.075 -0.094 -0.093
REALMMarine:human.sc -0.012 0.002 0.013 -0.011 -0.006 -0.004 0.001
REALMTerrestrial:human.sc -0.015 0.001 0.014 -0.013 -0.005 0.000 0.008
tmptrnd_bs.sc:h. REALMM:
temptrend_abs.sc
REALMMarine
REALMTerrestrial
tempave.sc
tempave_metab.sc
seas.sc
microclim.sc
mass.sc
lifespan.sc
endothermfrac.sc
nspp.sc
npp.sc
human.sc
temptrend_abs.sc:tempave.sc
temptrend_abs.sc:tempave_metab.sc
temptrend_abs.sc:seas.sc
temptrend_abs.sc:mass.sc
temptrend_abs.sc:lifespan.sc
temptrend_abs.sc:endothermfrac.sc
temptrend_abs.sc:nspp.sc
temptrend_abs.sc:npp.sc
temptrend_abs.sc:human.sc
REALMMarine:human.sc -0.006
REALMTerrestrial:human.sc -0.033 0.995
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-5.77259623 -0.36603342 0.04046067 0.55772869 6.71714363
Number of Observations: 42586
Number of Groups:
STUDY_ID rarefyID %in% STUDY_ID
218 42586
coefs2 <- summary(modTfullJbetasimpreml)$tTable
coefs3 <- summary(modTfullHornsimpreml)$tTable
varstoplot <- unique(c(rownames(coefs2), rownames(coefs3)))
rows1 <- which(!grepl('Intercept', varstoplot) | grepl(':', varstoplot)) # vars to plot in first graph
rows1_2 <- which(rownames(coefs2) %in% varstoplot[rows1]) # rows in coefs2
rows1_3 <- which(rownames(coefs3) %in% varstoplot[rows1]) # rows in coefs3
xlims1 <- range(c(coefs2[rows1_2,1] - coefs2[rows1_2,2],
coefs2[rows1_2,1] + coefs2[rows1_2,2],
coefs3[rows1_3,1] - coefs3[rows1_3,2],
coefs3[rows1_3,1] + coefs3[rows1_3,2]))
cols <- c('black', 'grey') # for Jbeta and Horn models, respectively
offs1 <- 0.1 # offset vertically for the two models
offs2 <- 0.01 # offset vertically for the two models (plot 2)
par(las = 1, mai = c(0.5, 3, 0.1, 0.1))
plot(0,0, col = 'white', xlim=xlims1, ylim = c(1,length(rows1)), yaxt='n', xlab = '', ylab ='')
axis(2, at = length(rows1):1, labels = varstoplot[rows1], cex.axis = 0.7)
abline(v = 0, col = 'grey')
for(i in 1:length(rows1)){
if(varstoplot[rows1[i]] %in% rownames(coefs2)){
x = coefs2[rownames(coefs2) == varstoplot[rows1[i]], 1]
se = coefs2[rownames(coefs2) == varstoplot[rows1[i]], 2]
points(x, length(rows1) + 1 - i + offs1, pch = 16, col = cols[1])
lines(x = c(x-se, x+se), y = c(length(rows1) + 1 - i + offs1, length(rows1) + 1 - i + offs1), col = cols[1])
}
if(varstoplot[rows1[i]] %in% rownames(coefs3)){
x = coefs3[rownames(coefs3) == varstoplot[rows1[i]], 1]
se = coefs3[rownames(coefs3) == varstoplot[rows1[i]], 2]
points(x, length(rows1) + 1 - i - offs1, pch = 16, col = cols[2])
lines(x = c(x-se, x+se), y = c(length(rows1) + 1 - i - offs1, length(rows1) + 1 - i - offs1), col = cols[2])
}
}
NA
NA
Black is for Jaccard total turnover (pres/abs), grey is for Morisita-Horn turnover (considers abundance)
coefs <- as.data.table(summary(modTfull1)$tTable)
coefs2 <- as.data.table(summary(modTfullJbeta)$tTable)
coefs3 <- as.data.table(summary(modTfullHorn)$tTable)
coefs$mod <- 'Jtu'
coefs2$mod <- 'Jbeta'
coefs3$mod <- 'Horn'
coefs$var <- rownames(summary(modTfull1)$tTable)
coefs2$var <- rownames(summary(modTfullJbeta)$tTable)
coefs3$var <- rownames(summary(modTfullHorn)$tTable)
# extract temperature effects and bind model coefs together
cols <- c('var', 'Value', 'Std.Error', 'mod')
allcoefsfull <- rbind(coefs[grep('temptrend|REALM', var), ..cols],
coefs2[grep('temptrend|REALM', var), ..cols],
coefs3[grep('temptrend|REALM', var), ..cols])
allcoefsfull$var[allcoefsfull$var == 'temptrend_abs.sc'] <- 'temptrend_abs.sc:REALMFreshwater'
# add average temperature effect (across realms) to realm-specific temperature effects
meantempeffect <- allcoefsfull[var %in% c('temptrend_abs.sc:REALMMarine', 'temptrend_abs.sc:REALMTerrestrial'), mean(Value), by = mod]$V1
allcoefsfull[var == 'temptrend_abs.sc:REALMMarine', Value := Value - meantempeffect]
allcoefsfull[var == 'temptrend_abs.sc:REALMTerrestrial', Value := Value - meantempeffect]
allcoefsfull[var == 'temptrend_abs.sc:REALMFreshwater', Value := -meantempeffect]
# add base temperature:human effect (freshwater) to realm-specific temperature:human effects
allcoefsfull$Value[allcoefsfull$var == 'temptrend_abs.sc:REALMMarine:human.sc'] <- with(allcoefsfull, Value[var == 'temptrend_abs.sc:REALMMarine:human.sc'] + Value[var == 'temptrend_abs.sc:human.sc'])
allcoefsfull$Value[allcoefsfull$var == 'temptrend_abs.sc:REALMTerrestrial:human.sc'] <- with(allcoefsfull, Value[var == 'temptrend_abs.sc:REALMTerrestrial:human.sc'] + Value[var == 'temptrend_abs.sc:human.sc'])
# remove non-temperature effects
allcoefsfull <- allcoefsfull[grepl(':', allcoefsfull$var) & grepl('temptrend', allcoefsfull$var), ]
# add info for plotting
allcoefsfull$lCI <- allcoefsfull$Value - allcoefsfull$Std.Error # lower confidence interval
allcoefsfull$uCI <- allcoefsfull$Value + allcoefsfull$Std.Error
nvar <- nrow(allcoefsfull)/3
allcoefsfull$y <- 1:nvar + rep(c(0, 0.1, 0.2), c(nvar, nvar, nvar)) # y-values
allcoefsfull$varname <- gsub('temptrend_abs.sc:|temptrend.sc:', '', allcoefsfull$var)
allcoefsfull$varname <- gsub('REALM', '', allcoefsfull$varname)
allcoefsfull$varname <- gsub('.sc', '', allcoefsfull$varname)
allcoefsfull$varname <- gsub('^human$', 'Freshwater:human', allcoefsfull$varname)
xlims1 <- c(-0.02, 0.02) # for realms
xlims2 <- c(-0.01, 0.015) # for traits
xlims3 <- c(-0.004, 0.0025) # for environment
xlims4 <- c(-0.016, 0.005) # for community
xlims5 <- c(-0.01, 0.015) # for human
ddg <- 0.5 # dodge for each model
set1 <- c('Terrestrial', 'Marine', 'Freshwater')
set2 <- c('mass', 'speed', 'lifespan', 'consumerfrac', 'endothermfrac', 'tempave_metab')
set3 <- c('seas', 'microclim', 'tempave')
set4 <- c('npp', 'nspp', 'thermal_bias')
set5 <- c('Terrestrial:human', 'Marine:human', 'Freshwater:human')
p1 <- ggplot(subset(allcoefsfull, varname %in% set1),
aes(varname, Value, group = mod, color = mod)) +
geom_hline(yintercept = 0, linetype = 'dashed', color = 'light grey') +
geom_errorbar(aes(ymin = lCI, ymax = uCI), width = 0, position = position_dodge(ddg)) +
geom_point(position = position_dodge(ddg)) +
labs(y = 'Interaction with temperature change effect', x = '', tag = 'A') +
scale_color_grey() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.position='none',
axis.text=element_text(size=7),
axis.title=element_text(size=7)) +
coord_flip(ylim = xlims1)
p2 <- ggplot(subset(allcoefsfull, varname %in% set2),
aes(varname, Value, group = mod, color = mod)) +
geom_hline(yintercept = 0, linetype = 'dashed', color = 'light grey') +
geom_errorbar(aes(ymin = lCI, ymax = uCI), width = 0, position = position_dodge(ddg)) +
geom_point(position = position_dodge(ddg)) +
labs(y = 'Interaction with temperature change effect', x = '', tag = 'B') +
scale_color_grey() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.position='none',
axis.text=element_text(size=7),
axis.title=element_text(size=7)) +
coord_flip(ylim = xlims2)
p3 <- ggplot(subset(allcoefsfull, varname %in% set3),
aes(varname, Value, group = mod, color = mod)) +
geom_hline(yintercept = 0, linetype = 'dashed', color = 'light grey') +
geom_errorbar(aes(ymin = lCI, ymax = uCI), width = 0, position = position_dodge(ddg)) +
geom_point(position = position_dodge(ddg)) +
labs(y = 'Interaction with temperature change effect', x = '', tag = 'C') +
scale_color_grey() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.position='none',
axis.text=element_text(size=7),
axis.title=element_text(size=7)) +
coord_flip(ylim = xlims3)
p4 <- ggplot(subset(allcoefsfull, varname %in% set4),
aes(varname, Value, group = mod, color = mod)) +
geom_hline(yintercept = 0, linetype = 'dashed', color = 'light grey') +
geom_errorbar(aes(ymin = lCI, ymax = uCI), width = 0, position = position_dodge(ddg)) +
geom_point(position = position_dodge(ddg)) +
labs(y = 'Interaction with temperature change effect', x = '', tag = 'D') +
scale_color_grey() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.position='none',
axis.text=element_text(size=7),
axis.title=element_text(size=7)) +
coord_flip(ylim = xlims4)
p5 <- ggplot(subset(allcoefsfull, varname %in% set5),
aes(varname, Value, group = mod, color = mod)) +
geom_hline(yintercept = 0, linetype = 'dashed', color = 'light grey') +
geom_errorbar(aes(ymin = lCI, ymax = uCI), width = 0, position = position_dodge(ddg)) +
geom_point(position = position_dodge(ddg)) +
labs(y = 'Interaction with temperature change effect', x = '', tag = 'E') +
scale_color_grey() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.position='none',
axis.text=element_text(size=7),
axis.title=element_text(size=7)) +
coord_flip(ylim = xlims5)
grid.arrange(p1, p2, p3, p4, p5, ncol = 2, layout_matrix = rbind(c(1,2), c(3,4), c(5, NA)))
NA
NA